package com.example.demotest.Dao;

import com.example.demotest.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class UserDao {
    @Autowired
    JdbcTemplate jdbcTemplate;
    public User getUserByName(String username){
        String sql="select * from user where username=?";
        return jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(User.class), username);
    }
}
